package com.ayq.activiti.manager.publish;

import com.ayq.activiti.manager.config.ActivitiRabbitMqConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ActivitiNodeInfoUpdatePublish {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendActivitiNodeInfoUpdate(String processInstanceId){
        Message message = new Message(processInstanceId.getBytes(), new MessageProperties());
        rabbitTemplate.convertAndSend(ActivitiRabbitMqConfig.ACTIVITI_NODE_INFO_UPDATE_EXCHANGE,ActivitiRabbitMqConfig.ACTIVITI_NODE_INFO_UPDATE,message);
        log.info("流程变更发送消息{}",processInstanceId);
    }

}
